package Player
{
    import Libs.Global;
    
    import alternativa.engine3d.core.Object3D;
    import alternativa.engine3d.materials.FillMaterial;
    import alternativa.engine3d.primitives.Box;
    
    import flash.display.*;
    import flash.events.*;

    public class Player extends Object3D
    {
        private var r:Number;
		private var hero_height:int = 160;
		private var my_color:uint;
        private var role:String;
        private var userName:String;
        private var money:Number;
        private var loginComplete:Boolean;
        private var moveStep:Number;

        public function Player(userName:String, role:String):void
        {
            this.userName = userName;
            this.r = 0;
            
            this.role = role;
            this.money = 0;
            this.loginComplete = false;
			if (role == "police")  my_color = Libs.Global.HERO_COLOR
			else my_color = Libs.Global.THIEF_COLOR;
			// car body
			var carBody:Box = new Box(80,80,120);
			var material:FillMaterial = new FillMaterial(my_color, 0.8);
			carBody.setMaterialToAllSurfaces(material);
			carBody.z = -60;
			addChild(carBody);
			// car front
			var carFront:Box = new Box(40,40,hero_height - 120);
			carFront.setMaterialToAllSurfaces(new FillMaterial(my_color,.9));
			carFront.z = - (hero_height-120)/2 - 120;
			addChild(carFront);		
        }// end function

        public function get Speed() : Number
        {
            return this.moveStep;
        }// end function

        public function addSpeed() : void
        {
            this.moveStep = Global.Quick_Move_STEP;
            return;
        }// end function

        public function subSpeed() : void
        {
            this.moveStep = Global.MOVE_STEP;
            return;
        }// end function

        public function get Money() : Number
        {
            return this.money;
        }// end function

        public function set Money(money:Number) : void
        {
            this.money = money;
            return;
        }// end function

        public function get Name() : String
        {
            return this.userName;
        }// end function

        public function get Role() : String
        {
            return this.role;
        }// end function

        public function set Role(role:String) : void
        {
            this.Role = role;
            return;
        }// end function

        public function get LoginComplete() : Boolean
        {
            return this.loginComplete;
        }// end function

        public function set LoginComplete(loginComplete:Boolean) : void
        {
            this.loginComplete = loginComplete;
            return;
        }// end function
    }
}
